home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / thunderx.c < prev    next >
C/C++ Source or Header  |  2000-04-23  |  32KB  |  898 lines

  1. /***************************************************************************
  2.  
  3. Super Contra / Thunder Cross
  4.  
  5. driver by Bryan McPhail, Manuel Abadia
  6.  
  7. ***************************************************************************/
  8.  
  9. #include "driver.h"
  10. #include "vidhrdw/generic.h"
  11. #include "cpu/konami/konami.h" /* for the callback and the firq irq definition */
  12. #include "vidhrdw/konamiic.h"
  13.  
  14. static void scontra_init_machine(void);
  15. static void thunderx_init_machine(void);
  16. static void thunderx_banking(int lines);
  17.  
  18. extern int scontra_priority;
  19. int scontra_vh_start(void);
  20. void scontra_vh_stop(void);
  21. void scontra_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  22.  
  23. /***************************************************************************/
  24.  
  25. static int scontra_interrupt( void )
  26. {
  27.     if (K052109_is_IRQ_enabled())
  28.         return KONAMI_INT_IRQ;
  29.     else
  30.         return ignore_interrupt();
  31. }
  32.  
  33. static int thunderx_interrupt( void )
  34. {
  35.     if (K052109_is_IRQ_enabled())
  36.     {
  37.         if (cpu_getiloops() == 0) return KONAMI_INT_IRQ;
  38.         else if (cpu_getiloops() & 1) return KONAMI_INT_FIRQ;    /* ??? */
  39.     }
  40.     return ignore_interrupt();
  41. }
  42.  
  43.  
  44. static int palette_selected;
  45. static int bank;
  46. static unsigned char *ram,*unknownram;
  47.  
  48. static READ_HANDLER( scontra_bankedram_r )
  49. {
  50.     if (palette_selected)
  51.         return paletteram_r(offset);
  52.     else
  53.         return ram[offset];
  54. }
  55.  
  56. static WRITE_HANDLER( scontra_bankedram_w )
  57. {
  58.     if (palette_selected)
  59.         paletteram_xBBBBBGGGGGRRRRR_swap_w(offset,data);
  60.     else
  61.         ram[offset] = data;
  62. }
  63.  
  64. static READ_HANDLER( thunderx_bankedram_r )
  65. {
  66.     if ((bank & 0x01) == 0)
  67.     {
  68.         if (bank & 0x10)
  69.             return unknownram[offset];
  70.         else
  71.             return paletteram_r(offset);
  72.     }
  73.     else
  74.         return ram[offset];
  75. }
  76.  
  77. static WRITE_HANDLER( thunderx_bankedram_w )
  78. {
  79.     if ((bank & 0x01) == 0)
  80.     {
  81.         if (bank & 0x10)
  82.             unknownram[offset] = data;
  83.         else
  84.             paletteram_xBBBBBGGGGGRRRRR_swap_w(offset,data);
  85.     }
  86.     else
  87.         ram[offset] = data;
  88. }
  89.  
  90. static void calculate_collisions( void ) {
  91.     unsigned char *ptr1 = &unknownram[0x10], *ptr2;
  92.     int i, j;
  93.  
  94.     /* each sprite is defined as: flags height width xpos ypos */
  95.     for( i = 0; i < 127; i++, ptr1 += 5 ) {
  96.         int w,h;
  97.         int    x,y;
  98.  
  99.         if ( ( ptr1[0] & 0x80 ) == 0x00 )
  100.             continue;
  101.  
  102.         ptr2 = ptr1 + 5;
  103.         w = 4; /* ? */
  104.         h = 4; /* ? */
  105.         x = ptr1[3];
  106.         y = ptr1[4];
  107.  
  108.         for( j = i+1; j < 128; j++, ptr2 += 5 ) {
  109.             int x1,y1;
  110.  
  111.             if ( ( ptr2[0] & 0x80 ) == 0x00 )
  112.                 continue;
  113.  
  114.             x1 = ptr2[3];
  115.             y1 = ptr2[4];
  116.  
  117.             x1 -= x;
  118.  
  119.             if ( x1 < 0 )
  120.                 x1 = -x1;
  121.  
  122.             if ( x1 > w )
  123.                 continue;
  124.  
  125.             y1 -= y;
  126.  
  127.             if ( y1 < 0 )
  128.                 y1 = -y1;
  129.  
  130.             if ( y1 > h )
  131.                 continue;
  132.  
  133. /*
  134. 00 - 02 - our ships
  135. 02 - 40 - our bullets
  136. 42 - 16 - enemy bullets
  137. 58 - 60 - enemy ships
  138. 118 - ? - ?
  139. */
  140.             if ( i > 117 )
  141.                 continue;
  142.  
  143.             if ( i < 42 ) { /* our ship & bullets */
  144.                 if ( j < 42 ) /* our ship & bullets */
  145.                     continue;
  146.             } else { /* enemy ships & bullets */
  147.                 if ( j > 41 ) /* enemy ships & bullets */
  148.                     continue;
  149.             }
  150.  
  151.             /* bullets dont collide eachother */
  152.             if ( i > 1 && i < 42 )
  153.                 if ( j > 41 && j < 58 )
  154.                     continue;
  155.  
  156.             /* collision */
  157.             if ( ptr1[0] & 0x20 )
  158.                 ptr1[0] |= 0x10;
  159.  
  160.             if ( ptr2[0] & 0x20 )
  161.                 ptr2[0] |= 0x10;
  162.         }
  163.     }
  164. }
  165.  
  166. static WRITE_HANDLER( thunderx_1f98_w )
  167. {
  168. //logerror("%04x: write %02x to 1f98\n",cpu_get_pc(),data);
  169.     /* bit 0 = enable char ROM reading through the video RAM */
  170.     K052109_set_RMRD_line((data & 0x01) ? ASSERT_LINE : CLEAR_LINE);
  171.  
  172.     /* bit 1 unknown - used by Thunder Cross during test of RAM C8 (5800-5fff) */
  173.     if ( data & 2 )
  174.         calculate_collisions();
  175. }
  176.  
  177. WRITE_HANDLER( scontra_bankswitch_w )
  178. {
  179.     unsigned char *RAM = memory_region(REGION_CPU1);
  180.     int offs;
  181.  
  182. //logerror("%04x: bank switch %02x\n",cpu_get_pc(),data);
  183.  
  184.     /* bits 0-3 ROM bank */
  185.     offs = 0x10000 + (data & 0x0f)*0x2000;
  186.     cpu_setbank( 1, &RAM[offs] );
  187.  
  188.     /* bit 4 select work RAM or palette RAM at 5800-5fff */
  189.     palette_selected = ~data & 0x10;
  190.  
  191.     /* bits 5/6 coin counters */
  192.     coin_counter_w(0,data & 0x20);
  193.     coin_counter_w(1,data & 0x40);
  194.  
  195.     /* bit 7 controls layer priority */
  196.     scontra_priority = data & 0x80;
  197. }
  198.  
  199. static WRITE_HANDLER( thunderx_videobank_w )
  200. {
  201. //logerror("%04x: select video ram bank %02x\n",cpu_get_pc(),data);
  202.     /* 0x01 = work RAM at 4000-5fff */
  203.     /* 0x00 = palette at 5800-5fff */
  204.     /* 0x10 = unknown RAM at 5800-5fff */
  205.     bank = data;
  206.  
  207.     /* bits 1/2 coin counters */
  208.     coin_counter_w(0,data & 0x02);
  209.     coin_counter_w(1,data & 0x04);
  210.  
  211.     /* bit 3 controls layer priority (seems to be always 1) */
  212.     scontra_priority = data & 0x08;
  213. }
  214.  
  215. static WRITE_HANDLER( thunderx_sh_irqtrigger_w )
  216. {
  217.     cpu_cause_interrupt(1,0xff);
  218. }
  219.  
  220. static WRITE_HANDLER( scontra_snd_bankswitch_w )
  221. {
  222.     unsigned char *RAM = memory_region(REGION_SOUND1);
  223.     /* b3-b2: bank for chanel B */
  224.     /* b1-b0: bank for chanel A */
  225.  
  226.     int bank_A = 0x20000*(data & 0x03);
  227.     int bank_B = 0x20000*((data >> 2) & 0x03);
  228.  
  229.     K007232_bankswitch(0,RAM + bank_A,RAM + bank_B);
  230. }
  231.  
  232. /***************************************************************************/
  233.  
  234. static struct MemoryReadAddress scontra_readmem[] =
  235. {
  236.     { 0x1f90, 0x1f90, input_port_0_r }, /* coin */
  237.     { 0x1f91, 0x1f91, input_port_1_r }, /* p1 */
  238.     { 0x1f92, 0x1f92, input_port_2_r }, /* p2 */
  239.     { 0x1f93, 0x1f93, input_port_5_r }, /* Dip 3 */
  240.     { 0x1f94, 0x1f94, input_port_3_r }, /* Dip 1 */
  241.     { 0x1f95, 0x1f95, input_port_4_r }, /* Dip 2 */
  242.  
  243.     { 0x0000, 0x3fff, K052109_051960_r },
  244.     { 0x4000, 0x57ff, MRA_RAM },
  245.     { 0x5800, 0x5fff, scontra_bankedram_r },            /* palette + work RAM */
  246.     { 0x6000, 0x7fff, MRA_BANK1 },
  247.     { 0x8000, 0xffff, MRA_ROM },
  248.     { -1 }    /* end of table */
  249. };
  250.  
  251. static struct MemoryReadAddress thunderx_readmem[] =
  252. {
  253.     { 0x1f90, 0x1f90, input_port_0_r }, /* coin */
  254.     { 0x1f91, 0x1f91, input_port_1_r }, /* p1 */
  255.     { 0x1f92, 0x1f92, input_port_2_r }, /* p2 */
  256.     { 0x1f93, 0x1f93, input_port_5_r }, /* Dip 3 */
  257.     { 0x1f94, 0x1f94, input_port_3_r }, /* Dip 1 */
  258.     { 0x1f95, 0x1f95, input_port_4_r }, /* Dip 2 */
  259.  
  260.     { 0x0000, 0x3fff, K052109_051960_r },
  261.     { 0x4000, 0x57ff, MRA_RAM },
  262.     { 0x5800, 0x5fff, thunderx_bankedram_r },            /* palette + work RAM + unknown RAM */
  263.     { 0x6000, 0x7fff, MRA_BANK1 },
  264.     { 0x8000, 0xffff, MRA_ROM },
  265.     { -1 }    /* end of table */
  266. };
  267.  
  268. static struct MemoryWriteAddress scontra_writemem[] =
  269. {
  270.     { 0x1f80, 0x1f80, scontra_bankswitch_w },    /* bankswitch control + coin counters */
  271.     { 0x1f84, 0x1f84, soundlatch_w },
  272.     { 0x1f88, 0x1f88, thunderx_sh_irqtrigger_w },        /* cause interrupt on audio CPU */
  273.     { 0x1f8c, 0x1f8c, watchdog_reset_w },
  274.     { 0x1f98, 0x1f98, thunderx_1f98_w },
  275.  
  276.     { 0x0000, 0x3fff, K052109_051960_w },        /* video RAM + sprite RAM */
  277.     { 0x4000, 0x57ff, MWA_RAM },
  278.     { 0x5800, 0x5fff, scontra_bankedram_w, &ram },            /* palette + work RAM */
  279.     { 0x6000, 0xffff, MWA_ROM },
  280.     { -1 }
  281. };
  282.  
  283. static struct MemoryWriteAddress thunderx_writemem[] =
  284. {
  285.     { 0x1f80, 0x1f80, thunderx_videobank_w },
  286.     { 0x1f84, 0x1f84, soundlatch_w },
  287.     { 0x1f88, 0x1f88, thunderx_sh_irqtrigger_w },        /* cause interrupt on audio CPU */
  288.     { 0x1f8c, 0x1f8c, watchdog_reset_w },
  289.     { 0x1f98, 0x1f98, thunderx_1f98_w },
  290.  
  291.     { 0x0000, 0x3fff, K052109_051960_w },
  292.     { 0x4000, 0x57ff, MWA_RAM },
  293.     { 0x5800, 0x5fff, thunderx_bankedram_w, &ram },            /* palette + work RAM + unknown RAM */
  294.     { 0x6000, 0xffff, MWA_ROM },
  295.     { -1 }    /* end of table */
  296. };
  297.  
  298. static struct MemoryReadAddress scontra_readmem_sound[] =
  299. {
  300.     { 0x0000, 0x7fff, MRA_ROM },                /* ROM */
  301.     { 0x8000, 0x87ff, MRA_RAM },                /* RAM */
  302.     { 0xa000, 0xa000, soundlatch_r },            /* soundlatch_r */
  303.     { 0xb000, 0xb00d, K007232_read_port_0_r },    /* 007232 registers */
  304.     { 0xc001, 0xc001, YM2151_status_port_0_r },    /* YM2151 */
  305.     { -1 }
  306. };
  307.  
  308. static struct MemoryWriteAddress scontra_writemem_sound[] =
  309. {
  310.     { 0x0000, 0x7fff, MWA_ROM },                    /* ROM */
  311.     { 0x8000, 0x87ff, MWA_RAM },                    /* RAM */
  312.     { 0xb000, 0xb00d, K007232_write_port_0_w },        /* 007232 registers */
  313.     { 0xc000, 0xc000, YM2151_register_port_0_w },    /* YM2151 */
  314.     { 0xc001, 0xc001, YM2151_data_port_0_w },        /* YM2151 */
  315.     { 0xf000, 0xf000, scontra_snd_bankswitch_w },    /* 007232 bank select */
  316.     { -1 }
  317. };
  318.  
  319. static struct MemoryReadAddress thunderx_readmem_sound[] =
  320. {
  321.     { 0x0000, 0x7fff, MRA_ROM },
  322.     { 0x8000, 0x87ff, MRA_RAM },
  323.     { 0xa000, 0xa000, soundlatch_r },
  324.     { 0xc001, 0xc001, YM2151_status_port_0_r },
  325.     { -1 }    /* end of table */
  326. };
  327.  
  328. static struct MemoryWriteAddress thunderx_writemem_sound[] =
  329. {
  330.     { 0x0000, 0x7fff, MWA_ROM },
  331.     { 0x8000, 0x87ff, MWA_RAM },
  332.     { 0xc000, 0xc000, YM2151_register_port_0_w },
  333.     { 0xc001, 0xc001, YM2151_data_port_0_w },
  334.     { -1 }    /* end of table */
  335. };
  336.  
  337. /***************************************************************************
  338.  
  339.     Input Ports
  340.  
  341. ***************************************************************************/
  342.  
  343. INPUT_PORTS_START( scontra )
  344.     PORT_START    /* COINSW */
  345.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  346.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  347.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  348.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  349.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  350.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  351.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  352.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  353.  
  354.     PORT_START    /* PLAYER 1 INPUTS */
  355.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER1 )
  356.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
  357.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER1 )
  358.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER1 )
  359.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  360.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  361.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  362.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  363.  
  364.     PORT_START    /* PLAYER 2 INPUTS */
  365.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
  366.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  367.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER2 )
  368.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
  369.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  370.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  371.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  372.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  373.  
  374.     PORT_START    /* DSW #1 */
  375.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
  376.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  377.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  378.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  379.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
  380.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
  381.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  382.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
  383.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  384.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  385.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
  386.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  387.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  388.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  389.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
  390.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
  391.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  392.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
  393.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
  394.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
  395.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  396.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
  397.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
  398.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  399.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
  400.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
  401.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  402.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
  403.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  404.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  405.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  406.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
  407.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  408. //    PORT_DIPSETTING(    0x00, "Invalid" )
  409.  
  410.     PORT_START    /* DSW #2 */
  411.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
  412.     PORT_DIPSETTING(    0x03, "2" )
  413.     PORT_DIPSETTING(    0x02, "3" )
  414.     PORT_DIPSETTING(    0x01, "5" )
  415.     PORT_DIPSETTING(    0x00, "7" )
  416.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )    /* test mode calls it cabinet type, */
  417.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )        /* but this is a 2 players game */
  418.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  419.     PORT_DIPNAME( 0x18, 0x10, DEF_STR( Bonus_Life ) )
  420.     PORT_DIPSETTING(    0x18, "30000 200000" )
  421.     PORT_DIPSETTING(    0x10, "50000 300000" )
  422.     PORT_DIPSETTING(    0x08, "30000" )
  423.     PORT_DIPSETTING(    0x00, "50000" )
  424.     PORT_DIPNAME( 0x60, 0x40, DEF_STR( Difficulty ) )
  425.     PORT_DIPSETTING(    0x60, "Easy" )
  426.     PORT_DIPSETTING(    0x40, "Normal" )
  427.     PORT_DIPSETTING(    0x20, "Difficult" )
  428.     PORT_DIPSETTING(    0x00, "Very Difficult" )
  429.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  430.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  431.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  432.  
  433.     PORT_START    /* DSW #3 */
  434.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  435.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  436.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  437.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  438.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  439.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  440.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  441.     PORT_DIPNAME( 0x08, 0x08, "Continue Limit" )
  442.     PORT_DIPSETTING(    0x08, "3" )
  443.     PORT_DIPSETTING(    0x00, "5" )
  444.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  445. INPUT_PORTS_END
  446.  
  447. INPUT_PORTS_START( thunderx )
  448.     PORT_START    /* IN0 */
  449.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  450.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  451.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  452.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  453.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  454.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  455.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  456.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  457.  
  458.     PORT_START    /* PLAYER 1 INPUTS */
  459.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER1 )
  460.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
  461.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER1 )
  462.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER1 )
  463.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  464.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  465.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  466.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  467.  
  468.     PORT_START    /* PLAYER 2 INPUTS */
  469.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
  470.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  471.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER2 )
  472.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
  473.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  474.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  475.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  476.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  477.  
  478.     PORT_START
  479.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
  480.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  481.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  482.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  483.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
  484.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
  485.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  486.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
  487.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  488.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  489.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
  490.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  491.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  492.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  493.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
  494.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
  495.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  496.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
  497.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
  498.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
  499.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  500.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
  501.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
  502.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  503.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
  504.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
  505.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  506.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
  507.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  508.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  509.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  510.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
  511.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  512. //    PORT_DIPSETTING(    0x00, "Invalid" )
  513.  
  514.      PORT_START
  515.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
  516.     PORT_DIPSETTING(    0x03, "2" )
  517.     PORT_DIPSETTING(    0x02, "3" )
  518.     PORT_DIPSETTING(    0x01, "5" )
  519.     PORT_DIPSETTING(    0x00, "7" )
  520.     PORT_DIPNAME( 0x04, 0x00, "Award Bonus Life" )
  521.     PORT_DIPSETTING(    0x04, DEF_STR( No ) )
  522.     PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
  523.     PORT_DIPNAME( 0x18, 0x18, DEF_STR( Bonus_Life ) )
  524.     PORT_DIPSETTING(    0x18, "30000 200000" )
  525.     PORT_DIPSETTING(    0x10, "50000 300000" )
  526.     PORT_DIPSETTING(    0x08, "30000" )
  527.     PORT_DIPSETTING(    0x00, "50000" )
  528.     PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) )
  529.     PORT_DIPSETTING(    0x60, "Easy" )
  530.     PORT_DIPSETTING(    0x40, "Normal" )
  531.     PORT_DIPSETTING(    0x20, "Difficult" )
  532.     PORT_DIPSETTING(    0x00, "Very Difficult" )
  533.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  534.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  535.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  536.  
  537.     PORT_START
  538.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  539.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  540.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  541.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  542.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  543.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  544.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  545.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
  546.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  547.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  548.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  549. INPUT_PORTS_END
  550.  
  551.  
  552.  
  553. /***************************************************************************
  554.  
  555.     Machine Driver
  556.  
  557. ***************************************************************************/
  558.  
  559. static struct YM2151interface ym2151_interface =
  560. {
  561.     1,            /* 1 chip */
  562.     3579545,    /* 3.579545 MHz */
  563.     { YM3012_VOL(100,MIXER_PAN_LEFT,100,MIXER_PAN_RIGHT) },
  564.     { 0 },
  565. };
  566.  
  567. static void volume_callback(int v)
  568. {
  569.     K007232_set_volume(0,0,(v >> 4) * 0x11,0);
  570.     K007232_set_volume(0,1,0,(v & 0x0f) * 0x11);
  571. }
  572.  
  573. static struct K007232_interface k007232_interface =
  574. {
  575.     1,        /* number of chips */
  576.     { REGION_SOUND1 },    /* memory regions */
  577.     { K007232_VOL(20,MIXER_PAN_CENTER,20,MIXER_PAN_CENTER) },    /* volume */
  578.     { volume_callback }    /* external port callback */
  579. };
  580.  
  581.  
  582.  
  583. static struct MachineDriver machine_driver_scontra =
  584. {
  585.     {
  586.         {
  587.             CPU_KONAMI,    /* 052001 */
  588.             3000000,    /* ? */
  589.             scontra_readmem,scontra_writemem,0,0,
  590.             scontra_interrupt,1
  591.         },
  592.         {
  593.             CPU_Z80 | CPU_AUDIO_CPU,
  594.             3579545,        /* ? */
  595.             scontra_readmem_sound,scontra_writemem_sound,0,0,
  596.             ignore_interrupt,0    /* interrupts are triggered by the main CPU */
  597.         }
  598.     },
  599.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  600.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  601.     scontra_init_machine,
  602.  
  603.     /* video hardware */
  604.     64*8, 32*8, { 14*8, (64-14)*8-1, 2*8, 30*8-1 },
  605.     0, /* gfx decoded by konamiic.c */
  606.     1024, 1024,
  607.     0,
  608.  
  609.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  610.     0,
  611.     scontra_vh_start,
  612.     scontra_vh_stop,
  613.     scontra_vh_screenrefresh,
  614.  
  615.     /* sound hardware */
  616.     0,0,0,0,
  617.     {
  618.         {
  619.             SOUND_YM2151,
  620.             &ym2151_interface
  621.         },
  622.         {
  623.             SOUND_K007232,
  624.             &k007232_interface
  625.         }
  626.     }
  627. };
  628.  
  629. static struct MachineDriver machine_driver_thunderx =
  630. {
  631.     {
  632.         {
  633.             CPU_KONAMI,
  634.             3000000,        /* ? */
  635.             thunderx_readmem,thunderx_writemem,0,0,
  636.             thunderx_interrupt,16    /* ???? */
  637.         },
  638.         {
  639.             CPU_Z80 | CPU_AUDIO_CPU,
  640.             3579545,        /* ? */
  641.             thunderx_readmem_sound,thunderx_writemem_sound,0,0,
  642.             ignore_interrupt,0    /* interrupts are triggered by the main CPU */
  643.         }
  644.     },
  645.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  646.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  647.     thunderx_init_machine,
  648.  
  649.     /* video hardware */
  650.     64*8, 32*8, { 14*8, (64-14)*8-1, 2*8, 30*8-1 },
  651.     0, /* gfx decoded by konamiic.c */
  652.     1024, 1024,
  653.     0,
  654.  
  655.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  656.     0,
  657.     scontra_vh_start,
  658.     scontra_vh_stop,
  659.     scontra_vh_screenrefresh,
  660.  
  661.     /* sound hardware */
  662.     0,0,0,0,
  663.     {
  664.         {
  665.             SOUND_YM2151,
  666.             &ym2151_interface
  667.         }
  668.     }
  669. };
  670.  
  671.  
  672. /***************************************************************************
  673.  
  674.   Game ROMs
  675.  
  676. ***************************************************************************/
  677.  
  678. ROM_START( scontra )
  679.     ROM_REGION( 0x30800, REGION_CPU1 )    /* ROMs + banked RAM */
  680.     ROM_LOAD( "e02.k11",     0x10000, 0x08000, 0xa61c0ead )    /* banked ROM */
  681.     ROM_CONTINUE(            0x08000, 0x08000 )                /* fixed ROM */
  682.     ROM_LOAD( "e03.k13",     0x20000, 0x10000, 0x00b02622 )    /* banked ROM */
  683.  
  684.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the SOUND CPU */
  685.     ROM_LOAD( "775-c01.bin", 0x00000, 0x08000, 0x0ced785a )
  686.  
  687.     ROM_REGION( 0x100000, REGION_GFX1 ) /* tiles */
  688.     ROM_LOAD_GFX_EVEN( "775-a07a.bin", 0x00000, 0x20000, 0xe716bdf3 )    /* tiles */
  689.     ROM_LOAD_GFX_ODD(  "775-a07e.bin", 0x00000, 0x20000, 0x0986e3a5 )
  690.     ROM_LOAD_GFX_EVEN( "775-f07c.bin", 0x40000, 0x10000, 0xb0b30915 )
  691.     ROM_LOAD_GFX_ODD(  "775-f07g.bin", 0x40000, 0x10000, 0xfbed827d )
  692.     ROM_LOAD_GFX_EVEN( "775-f07d.bin", 0x60000, 0x10000, 0xf184be8e )
  693.     ROM_LOAD_GFX_ODD(  "775-f07h.bin", 0x60000, 0x10000, 0x7b56c348 )
  694.     ROM_LOAD_GFX_EVEN( "775-a08a.bin", 0x80000, 0x20000, 0x3ddd11a4 )
  695.     ROM_LOAD_GFX_ODD(  "775-a08e.bin", 0x80000, 0x20000, 0x1007d963 )
  696.     ROM_LOAD_GFX_EVEN( "775-f08c.bin", 0xc0000, 0x10000, 0x53abdaec )
  697.     ROM_LOAD_GFX_ODD(  "775-f08g.bin", 0xc0000, 0x10000, 0x3df85a6e )
  698.     ROM_LOAD_GFX_EVEN( "775-f08d.bin", 0xe0000, 0x10000, 0x102dcace )
  699.     ROM_LOAD_GFX_ODD(  "775-f08h.bin", 0xe0000, 0x10000, 0xad9d7016 )
  700.  
  701.     ROM_REGION( 0x100000, REGION_GFX2 ) /* sprites */
  702.     ROM_LOAD_GFX_EVEN( "775-a05a.bin", 0x00000, 0x10000, 0xa0767045 )    /* sprites */
  703.     ROM_LOAD_GFX_ODD(  "775-a05e.bin", 0x00000, 0x10000, 0x2f656f08 )
  704.     ROM_LOAD_GFX_EVEN( "775-a05b.bin", 0x20000, 0x10000, 0xab8ad4fd )
  705.     ROM_LOAD_GFX_ODD(  "775-a05f.bin", 0x20000, 0x10000, 0x1c0eb1b6 )
  706.     ROM_LOAD_GFX_EVEN( "775-f05c.bin", 0x40000, 0x10000, 0x5647761e )
  707.     ROM_LOAD_GFX_ODD(  "775-f05g.bin", 0x40000, 0x10000, 0xa1692cca )
  708.     ROM_LOAD_GFX_EVEN( "775-f05d.bin", 0x60000, 0x10000, 0xad676a6f )
  709.     ROM_LOAD_GFX_ODD(  "775-f05h.bin", 0x60000, 0x10000, 0x3f925bcf )
  710.     ROM_LOAD_GFX_EVEN( "775-a06a.bin", 0x80000, 0x10000, 0x77a34ad0 )
  711.     ROM_LOAD_GFX_ODD(  "775-a06e.bin", 0x80000, 0x10000, 0x8a910c94 )
  712.     ROM_LOAD_GFX_EVEN( "775-a06b.bin", 0xa0000, 0x10000, 0x563fb565 )
  713.     ROM_LOAD_GFX_ODD(  "775-a06f.bin", 0xa0000, 0x10000, 0xe14995c0 )
  714.     ROM_LOAD_GFX_EVEN( "775-f06c.bin", 0xc0000, 0x10000, 0x5ee6f3c1 )
  715.     ROM_LOAD_GFX_ODD(  "775-f06g.bin", 0xc0000, 0x10000, 0x2645274d )
  716.     ROM_LOAD_GFX_EVEN( "775-f06d.bin", 0xe0000, 0x10000, 0xc8b764fa )
  717.     ROM_LOAD_GFX_ODD(  "775-f06h.bin", 0xe0000, 0x10000, 0xd6595f59 )
  718.  
  719.     ROM_REGION( 0x80000, REGION_SOUND1 )    /* k007232 data */
  720.     ROM_LOAD( "775-a04a.bin", 0x00000, 0x10000, 0x7efb2e0f )
  721.     ROM_LOAD( "775-a04b.bin", 0x10000, 0x10000, 0xf41a2b33 )
  722.     ROM_LOAD( "775-a04c.bin", 0x20000, 0x10000, 0xe4e58f14 )
  723.     ROM_LOAD( "775-a04d.bin", 0x30000, 0x10000, 0xd46736f6 )
  724.     ROM_LOAD( "775-f04e.bin", 0x40000, 0x10000, 0xfbf7e363 )
  725.     ROM_LOAD( "775-f04f.bin", 0x50000, 0x10000, 0xb031ef2d )
  726.     ROM_LOAD( "775-f04g.bin", 0x60000, 0x10000, 0xee107bbb )
  727.     ROM_LOAD( "775-f04h.bin", 0x70000, 0x10000, 0xfb0fab46 )
  728.  
  729.     ROM_REGION( 0x0100, REGION_PROMS )
  730.     ROM_LOAD( "775a09.b19",   0x0000, 0x0100, 0x46d1e0df )    /* priority encoder (not used) */
  731. ROM_END
  732.  
  733. ROM_START( scontraj )
  734.     ROM_REGION( 0x30800, REGION_CPU1 )    /* ROMs + banked RAM */
  735.     ROM_LOAD( "775-f02.bin", 0x10000, 0x08000, 0x8d5933a7 )    /* banked ROM */
  736.     ROM_CONTINUE(            0x08000, 0x08000 )                /* fixed ROM */
  737.     ROM_LOAD( "775-f03.bin", 0x20000, 0x10000, 0x1ef63d80 )    /* banked ROM */
  738.  
  739.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the SOUND CPU */
  740.     ROM_LOAD( "775-c01.bin", 0x00000, 0x08000, 0x0ced785a )
  741.  
  742.     ROM_REGION( 0x100000, REGION_GFX1 ) /* tiles */
  743.     ROM_LOAD_GFX_EVEN( "775-a07a.bin", 0x00000, 0x20000, 0xe716bdf3 )    /* tiles */
  744.     ROM_LOAD_GFX_ODD(  "775-a07e.bin", 0x00000, 0x20000, 0x0986e3a5 )
  745.     ROM_LOAD_GFX_EVEN( "775-f07c.bin", 0x40000, 0x10000, 0xb0b30915 )
  746.     ROM_LOAD_GFX_ODD(  "775-f07g.bin", 0x40000, 0x10000, 0xfbed827d )
  747.     ROM_LOAD_GFX_EVEN( "775-f07d.bin", 0x60000, 0x10000, 0xf184be8e )
  748.     ROM_LOAD_GFX_ODD(  "775-f07h.bin", 0x60000, 0x10000, 0x7b56c348 )
  749.     ROM_LOAD_GFX_EVEN( "775-a08a.bin", 0x80000, 0x20000, 0x3ddd11a4 )
  750.     ROM_LOAD_GFX_ODD(  "775-a08e.bin", 0x80000, 0x20000, 0x1007d963 )
  751.     ROM_LOAD_GFX_EVEN( "775-f08c.bin", 0xc0000, 0x10000, 0x53abdaec )
  752.     ROM_LOAD_GFX_ODD(  "775-f08g.bin", 0xc0000, 0x10000, 0x3df85a6e )
  753.     ROM_LOAD_GFX_EVEN( "775-f08d.bin", 0xe0000, 0x10000, 0x102dcace )
  754.     ROM_LOAD_GFX_ODD(  "775-f08h.bin", 0xe0000, 0x10000, 0xad9d7016 )
  755.  
  756.     ROM_REGION( 0x100000, REGION_GFX2 ) /* sprites */
  757.     ROM_LOAD_GFX_EVEN( "775-a05a.bin", 0x00000, 0x10000, 0xa0767045 )    /* sprites */
  758.     ROM_LOAD_GFX_ODD(  "775-a05e.bin", 0x00000, 0x10000, 0x2f656f08 )
  759.     ROM_LOAD_GFX_EVEN( "775-a05b.bin", 0x20000, 0x10000, 0xab8ad4fd )
  760.     ROM_LOAD_GFX_ODD(  "775-a05f.bin", 0x20000, 0x10000, 0x1c0eb1b6 )
  761.     ROM_LOAD_GFX_EVEN( "775-f05c.bin", 0x40000, 0x10000, 0x5647761e )
  762.     ROM_LOAD_GFX_ODD(  "775-f05g.bin", 0x40000, 0x10000, 0xa1692cca )
  763.     ROM_LOAD_GFX_EVEN( "775-f05d.bin", 0x60000, 0x10000, 0xad676a6f )
  764.     ROM_LOAD_GFX_ODD(  "775-f05h.bin", 0x60000, 0x10000, 0x3f925bcf )
  765.     ROM_LOAD_GFX_EVEN( "775-a06a.bin", 0x80000, 0x10000, 0x77a34ad0 )
  766.     ROM_LOAD_GFX_ODD(  "775-a06e.bin", 0x80000, 0x10000, 0x8a910c94 )
  767.     ROM_LOAD_GFX_EVEN( "775-a06b.bin", 0xa0000, 0x10000, 0x563fb565 )
  768.     ROM_LOAD_GFX_ODD(  "775-a06f.bin", 0xa0000, 0x10000, 0xe14995c0 )
  769.     ROM_LOAD_GFX_EVEN( "775-f06c.bin", 0xc0000, 0x10000, 0x5ee6f3c1 )
  770.     ROM_LOAD_GFX_ODD(  "775-f06g.bin", 0xc0000, 0x10000, 0x2645274d )
  771.     ROM_LOAD_GFX_EVEN( "775-f06d.bin", 0xe0000, 0x10000, 0xc8b764fa )
  772.     ROM_LOAD_GFX_ODD(  "775-f06h.bin", 0xe0000, 0x10000, 0xd6595f59 )
  773.  
  774.     ROM_REGION( 0x80000, REGION_SOUND1 )    /* k007232 data */
  775.     ROM_LOAD( "775-a04a.bin", 0x00000, 0x10000, 0x7efb2e0f )
  776.     ROM_LOAD( "775-a04b.bin", 0x10000, 0x10000, 0xf41a2b33 )
  777.     ROM_LOAD( "775-a04c.bin", 0x20000, 0x10000, 0xe4e58f14 )
  778.     ROM_LOAD( "775-a04d.bin", 0x30000, 0x10000, 0xd46736f6 )
  779.     ROM_LOAD( "775-f04e.bin", 0x40000, 0x10000, 0xfbf7e363 )
  780.     ROM_LOAD( "775-f04f.bin", 0x50000, 0x10000, 0xb031ef2d )
  781.     ROM_LOAD( "775-f04g.bin", 0x60000, 0x10000, 0xee107bbb )
  782.     ROM_LOAD( "775-f04h.bin", 0x70000, 0x10000, 0xfb0fab46 )
  783.  
  784.     ROM_REGION( 0x0100, REGION_PROMS )
  785.     ROM_LOAD( "775a09.b19",   0x0000, 0x0100, 0x46d1e0df )    /* priority encoder (not used) */
  786. ROM_END
  787.  
  788. ROM_START( thunderx )
  789.     ROM_REGION( 0x29000, REGION_CPU1 )    /* ROMs + banked RAM */
  790.     ROM_LOAD( "873k03.k15", 0x10000, 0x10000, 0x276817ad )
  791.     ROM_LOAD( "873k02.k13", 0x20000, 0x08000, 0x80cc1c45 )
  792.     ROM_CONTINUE(           0x08000, 0x08000 )
  793.  
  794.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  795.     ROM_LOAD( "873h01.f8",    0x0000, 0x8000, 0x990b7a7c )
  796.  
  797.     ROM_REGION( 0x80000, REGION_GFX1 )    /* temporary space for graphics (disposed after conversion) */
  798.     ROM_LOAD_GFX_EVEN( "873c06a.f6",   0x00000, 0x10000, 0x0e340b67 ) /* Chars */
  799.     ROM_LOAD_GFX_ODD ( "873c06c.f5",   0x00000, 0x10000, 0xef0e72cd )
  800.     ROM_LOAD_GFX_EVEN( "873c06b.e6",   0x20000, 0x10000, 0x97ad202e )
  801.     ROM_LOAD_GFX_ODD ( "873c06d.e5",   0x20000, 0x10000, 0x8393d42e )
  802.     ROM_LOAD_GFX_EVEN( "873c07a.f4",   0x40000, 0x10000, 0xa8aab84f )
  803.     ROM_LOAD_GFX_ODD ( "873c07c.f3",   0x40000, 0x10000, 0x2521009a )
  804.     ROM_LOAD_GFX_EVEN( "873c07b.e4",   0x60000, 0x10000, 0x12a2b8ba )
  805.     ROM_LOAD_GFX_ODD ( "873c07d.e3",   0x60000, 0x10000, 0xfae9f965 )
  806.  
  807.     ROM_REGION( 0x80000, REGION_GFX2 )
  808.     ROM_LOAD_GFX_EVEN( "873c04a.f11",  0x00000, 0x10000, 0xf7740bf3 ) /* Sprites */
  809.     ROM_LOAD_GFX_ODD ( "873c04c.f10",  0x00000, 0x10000, 0x5dacbd2b )
  810.     ROM_LOAD_GFX_EVEN( "873c04b.e11",  0x20000, 0x10000, 0x9ac581da )
  811.     ROM_LOAD_GFX_ODD ( "873c04d.e10",  0x20000, 0x10000, 0x44a4668c )
  812.     ROM_LOAD_GFX_EVEN( "873c05a.f9",   0x40000, 0x10000, 0xd73e107d )
  813.     ROM_LOAD_GFX_ODD ( "873c05c.f8",   0x40000, 0x10000, 0x59903200 )
  814.     ROM_LOAD_GFX_EVEN( "873c05b.e9",   0x60000, 0x10000, 0x81059b99 )
  815.     ROM_LOAD_GFX_ODD ( "873c05d.e8",   0x60000, 0x10000, 0x7fa3d7df )
  816.  
  817.     ROM_REGION( 0x0100, REGION_PROMS )
  818.     ROM_LOAD( "873a08.f20",   0x0000, 0x0100, 0xe2d09a1b )    /* priority encoder (not used) */
  819. ROM_END
  820.  
  821. ROM_START( thnderxj )
  822.     ROM_REGION( 0x29000, REGION_CPU1 )    /* ROMs + banked RAM */
  823.     ROM_LOAD( "873-n03.k15", 0x10000, 0x10000, 0xa01e2e3e )
  824.     ROM_LOAD( "873-n02.k13", 0x20000, 0x08000, 0x55afa2cc )
  825.     ROM_CONTINUE(            0x08000, 0x08000 )
  826.  
  827.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  828.     ROM_LOAD( "873-f01.f8",   0x0000, 0x8000, 0xea35ffa3 )
  829.  
  830.     ROM_REGION( 0x80000, REGION_GFX1 )    /* temporary space for graphics (disposed after conversion) */
  831.     ROM_LOAD_GFX_EVEN( "873c06a.f6",   0x00000, 0x10000, 0x0e340b67 ) /* Chars */
  832.     ROM_LOAD_GFX_ODD ( "873c06c.f5",   0x00000, 0x10000, 0xef0e72cd )
  833.     ROM_LOAD_GFX_EVEN( "873c06b.e6",   0x20000, 0x10000, 0x97ad202e )
  834.     ROM_LOAD_GFX_ODD ( "873c06d.e5",   0x20000, 0x10000, 0x8393d42e )
  835.     ROM_LOAD_GFX_EVEN( "873c07a.f4",   0x40000, 0x10000, 0xa8aab84f )
  836.     ROM_LOAD_GFX_ODD ( "873c07c.f3",   0x40000, 0x10000, 0x2521009a )
  837.     ROM_LOAD_GFX_EVEN( "873c07b.e4",   0x60000, 0x10000, 0x12a2b8ba )
  838.     ROM_LOAD_GFX_ODD ( "873c07d.e3",   0x60000, 0x10000, 0xfae9f965 )
  839.  
  840.     ROM_REGION( 0x80000, REGION_GFX2 )
  841.     ROM_LOAD_GFX_EVEN( "873c04a.f11",  0x00000, 0x10000, 0xf7740bf3 ) /* Sprites */
  842.     ROM_LOAD_GFX_ODD ( "873c04c.f10",  0x00000, 0x10000, 0x5dacbd2b )
  843.     ROM_LOAD_GFX_EVEN( "873c04b.e11",  0x20000, 0x10000, 0x9ac581da )
  844.     ROM_LOAD_GFX_ODD ( "873c04d.e10",  0x20000, 0x10000, 0x44a4668c )
  845.     ROM_LOAD_GFX_EVEN( "873c05a.f9",   0x40000, 0x10000, 0xd73e107d )
  846.     ROM_LOAD_GFX_ODD ( "873c05c.f8",   0x40000, 0x10000, 0x59903200 )
  847.     ROM_LOAD_GFX_EVEN( "873c05b.e9",   0x60000, 0x10000, 0x81059b99 )
  848.     ROM_LOAD_GFX_ODD ( "873c05d.e8",   0x60000, 0x10000, 0x7fa3d7df )
  849.  
  850.     ROM_REGION( 0x0100, REGION_PROMS )
  851.     ROM_LOAD( "873a08.f20",   0x0000, 0x0100, 0xe2d09a1b )    /* priority encoder (not used) */
  852. ROM_END
  853.  
  854. /***************************************************************************/
  855.  
  856. static void thunderx_banking( int lines )
  857. {
  858.     unsigned char *RAM = memory_region(REGION_CPU1);
  859.     int offs;
  860.  
  861. //    logerror("thunderx %04x: bank select %02x\n", cpu_get_pc(), lines );
  862.  
  863.     offs = 0x10000 + (((lines & 0x0f) ^ 0x08) * 0x2000);
  864.     if (offs >= 0x28000) offs -= 0x20000;
  865.     cpu_setbank( 1, &RAM[offs] );
  866. }
  867.  
  868. static void scontra_init_machine( void )
  869. {
  870.     unsigned char *RAM = memory_region(REGION_CPU1);
  871.  
  872.     paletteram = &RAM[0x30000];
  873. }
  874.  
  875. static void thunderx_init_machine( void )
  876. {
  877.     unsigned char *RAM = memory_region(REGION_CPU1);
  878.  
  879.     konami_cpu_setlines_callback = thunderx_banking;
  880.     cpu_setbank( 1, &RAM[0x10000] ); /* init the default bank */
  881.  
  882.     paletteram = &RAM[0x28000];
  883.     unknownram = &RAM[0x28800];
  884. }
  885.  
  886. static void init_scontra(void)
  887. {
  888.     konami_rom_deinterleave_2(REGION_GFX1);
  889.     konami_rom_deinterleave_2(REGION_GFX2);
  890. }
  891.  
  892.  
  893.  
  894. GAME( 1988, scontra,  0,        scontra,  scontra,  scontra, ROT90, "Konami", "Super Contra" )
  895. GAME( 1988, scontraj, scontra,  scontra,  scontra,  scontra, ROT90, "Konami", "Super Contra (Japan)" )
  896. GAMEX(1988, thunderx, 0,        thunderx, thunderx, scontra, ROT0, "Konami", "Thunder Cross", GAME_NOT_WORKING )
  897. GAMEX(1988, thnderxj, thunderx, thunderx, thunderx, scontra, ROT0, "Konami", "Thunder Cross (Japan)", GAME_NOT_WORKING )
  898.